package com.etc.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.etc.entity.CommentResult;
import com.etc.service.HouseholdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HouseholdController {
    @Autowired
    private HouseholdService householdService;

    @RequestMapping("household/delBatch")
    public CommentResult delBatch(@RequestBody String ids){
        String res = JSON.toJSON(ids).toString();
        List<Integer> delIds = JSONArray.parseArray(res,Integer.class);
        int result = householdService.delBatch(delIds);
        if (result>0){
            return new CommentResult(200,"删除成功");
        }
        return new CommentResult(444,"failed");
    }

}
